package com.shop2cn.app.liveseller.testcase;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Random;

import org.json.JSONObject;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.google.gson.JsonObject;
import com.shop2cn.app.liveseller.parameter.SellerLiveDetailBean;
import com.shop2cn.app.liveseller.service.SellerLiveDetailCall;
import com.ymatou.livevideo.parameter.RecLiveNotifyBean;
import com.ymt.core.tool.FormatUtil;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.AuthCallServiceV2;
import com.ymttest.business.service.LiveRoomShop2cnCallService;
import com.ymttest.business.service.shenqi.GodmchManageCallService;
import com.ymttest.database.model.livesellerShop2cn.*;
import com.ymttest.database.model.Userinfo;
import com.ymttest.database.sqlwapper.livesellerShop2cn.LiveRoomShop2cnWapper;
import com.ymttest.utils.DesUtil;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.TestDataManager;
import com.ymttest.utils.YMTDateUtil;

/**
 * 买手互动直播详情 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_SellerLiveDetail {
	private static SellerLiveDetailBean sellerlivedetailBean;
	private static SellerLiveDetailCall sellerlivedetailCall;
	private static LiveRoomShop2cnWapper liveRoomShop2nWapper;
	private static int sellerId ;
	private static String token ;
	private static int csId;
	private static String cstoken;

	@BeforeClass
	public static void setUp() throws Exception {
		Logger.createResultFile("买手互动直播详情");
		sellerId = GodmchManageCallService.CreateSellerMch();
		token=AuthCallServiceV2.createToken(sellerId, "app");
		csId = GodmchManageCallService.bindClientService(
				sellerId, 1);
		cstoken = AuthCallServiceV2.createToken(csId, "app");
	}

	@Before
	public void caseUp() {
		sellerlivedetailBean = new SellerLiveDetailBean();
		sellerlivedetailCall = new SellerLiveDetailCall();
		liveRoomShop2nWapper = new LiveRoomShop2cnWapper();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(sellerlivedetailCall.getOpurl());
		liveRoomShop2nWapper = null;
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	private void verifyDB(JsonObject livedto, int liveid) throws Exception {
		Logger.comment("数据库验证");
		LiveRoom dblive = liveRoomShop2nWapper.selectLiveRoomById(liveid);
		Logger.debug(FormatUtil.beanToGSONString(dblive));
		System.out.println(dblive);
		System.out.println(livedto);
		int diff1=YMTDateUtil.diffSecond(new Date(Long.valueOf(livedto.get("endTime").getAsString())),  YMTDateUtil.getDate( dblive.getEndTime(), YMTDateUtil.YMDHMSS));
		Logger.verifyEquals(true ,diff1<5, "验证EndTime");
		int diff2=YMTDateUtil.diffSecond(new Date(Long.valueOf(livedto.get("startTime").getAsString())),  YMTDateUtil.getDate( dblive.getStartTime(), YMTDateUtil.YMDHMSS));
		Logger.verifyEquals(true ,diff2<5, "验证StartTime");
		int diff3=YMTDateUtil.diffSecond(new Date(Long.valueOf(livedto.get("createTime").getAsString())),  YMTDateUtil.getDate( dblive.getCreateTime(), YMTDateUtil.YMDHMSS));
		Logger.verifyEquals(true ,diff3<5, "验证CreateTime");
		int diff4=YMTDateUtil.diffSecond(new Date(Long.valueOf(livedto.get("updateTime").getAsString())),  YMTDateUtil.getDate( dblive.getUpdateTime(), YMTDateUtil.YMDHMSS));
		Logger.verifyEquals(true ,diff4<5, "验证UpdateTime");
		
		
		Logger.verifyEquals(livedto.get("groupId").getAsString(), dblive.getGroupId(), "验证GroupId");
		Logger.verifyEquals(livedto.get("latitude").getAsString(), dblive.getLatitude(), "验证Latitude");
		Logger.verifyEquals(livedto.get("longitude").getAsString(), dblive.getLongitude(), "验证Longitude");
		Logger.verifyEquals(livedto.get("liveAddress").getAsString(), dblive.getLiveAddress(), "验证LiveAddress");
		Logger.verifyEquals(livedto.get("liveCover").getAsString(), dblive.getLiveCover(), "验证LiveCover");
		Logger.verifyEquals(livedto.get("liveTitle").getAsString(), dblive.getLiveTitle(), "验证LiveTitle");
		Logger.verifyEquals(livedto.get("preVideoHeight").getAsInt(), dblive.getPreVideoHeight(), "验证PreVideoHeight");
		Logger.verifyEquals(livedto.get("preVideoLength").getAsInt(), dblive.getPreVideoLength(), "验证PreVideoLength");
		Logger.verifyEquals(livedto.get("preVideoPic").getAsString(), dblive.getPreVideoPic(), "验证PreVideoPic");
		Logger.verifyEquals(livedto.get("preVideoWidth").getAsInt(), dblive.getPreVideoWidth(), "验证PreVideoWidth");
//		Logger.verifyEquals(livedto.get("sellerName").getAsString(), dblive.getSellerName(), "验证SellerName");
		Logger.verifyEquals(livedto.get("userId").getAsInt(), dblive.getUserId(), "验证UserId");
		Logger.verifyEquals(livedto.get("preVideoUrl").getAsString(), dblive.getPreVideoUrl(), "验证PreVideoUrl");
		Logger.verifyEquals(livedto.get("pushUrl").getAsString(), dblive.getPushUrl(), "验证PushUrl");
		String playurl = DesUtil.decrypt(dblive.getPlayUrl(), DesUtil.DES_KEY_STRING, DesUtil.DES_IVPARAMETER);
		// rtmp://12808.liveplay.myqcloud.com/live/12808_SIT1_4028_550
		//这里按照disconf配置走 liveseller现在配置老域名模式
		Logger.debug("playurl：" + playurl);
		String mypurl = "https://" + LiveRoomShop2cnCallService.PlaySellerDomain + "/live/" + LiveRoomShop2cnCallService.BizId + "_" + EnvSetup.getEnv().toUpperCase() + "_"
				+ livedto.get("id") + "_700.flv";
		Logger.verifyEquals(livedto.get("playUrl").getAsString(),mypurl, "验证PlayUrl");
		Logger.verifyEquals(livedto.get("historyPlayUrl").getAsString(), dblive.getHistoryPlayUrl() == null ? "" : dblive.getHistoryPlayUrl(), "验证HistoryPlayUrl");
		Logger.verifyEquals(livedto.get("stopReason").getAsString(), dblive.getStopReason(), "验证StopReason");
		Logger.verifyEquals(livedto.get("livePush").getAsInt(), dblive.getLivePush(), "验证LivePush");

		String LiveStatusText = "";
		int livestatus = dblive.getLiveStatus();
		if (dblive.getLiveStatus() == 0 && dblive.getStartTime().compareTo(YMTDateUtil.getSysTime()) > 0) {
			LiveStatusText = "未开始";
		} else if (dblive.getLiveStatus() == 0 && dblive.getStartTime().compareTo(YMTDateUtil.getSysTime()) <= 0) {
			LiveStatusText = "待开始";
			livestatus = 1;
		} else if (dblive.getLiveStatus() == 2) {
			LiveStatusText = "进行中";
		} else if (dblive.getLiveStatus() == 3) {
			LiveStatusText = "进行中";
		} else if (dblive.getLiveStatus() == 7&&dblive.getLivePush()==0) {
			//未推流8 推流9
			livestatus = 8;
			LiveStatusText = "已关闭";
		} else if (dblive.getLiveStatus() == 7&&dblive.getLivePush()==1) {
			//未推流8 推流9
			livestatus = 9;
			LiveStatusText = "已结束";
		} else if (dblive.getLiveStatus() == 8) {
			LiveStatusText = "已关闭";
		} else if (dblive.getLiveStatus() == 9) {
			LiveStatusText = "已结束";
		} else if (dblive.getLiveStatus() == 10) {
			livestatus = 9;
			LiveStatusText = "已结束";
		}
		Logger.verifyEquals(livedto.get("liveStatus").getAsInt(), livestatus, "验证LiveStatus");
		Logger.verifyEquals(livedto.get("liveStatusText").getAsString(), LiveStatusText, "验证LiveStatusText");

		Map rstat = (Map) liveRoomShop2nWapper.selectLiveRoomStatById(liveid);
//		Logger.debug(rstat);
		// "ViewNum":185,"OnLineNum":1,"LikeNum":0

	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SellerLiveDetail_001() {
		Logger.start(true, "查询买手互动直播详情成功");
		try {
			LiveRoom createlive = LiveRoomShop2cnCallService.CreateSellerLive(LiveRoomShop2cnCallService.initCreatesellerliveBean(),sellerId);
			LiveRoomShop2cnCallService.enterGroup(createlive.getId(), 1);
			LiveRoomShop2cnCallService.getLikeCount(createlive.getId(), 1, 2);
			sellerlivedetailBean.setLiveId(createlive.getId());
			sellerlivedetailCall.setData(sellerlivedetailBean);
			sellerlivedetailCall.addHeader("ymt-pars", "accesstoken=" + token);sellerlivedetailCall.addHeader("ymt-pars", "accesstoken=" + token);sellerlivedetailCall.callService();
//			
			System.out.println(sellerlivedetailCall.getJsonObject().get("liveRoomDto").getAsJsonObject());
			verifyDB(sellerlivedetailCall.getJsonObject().get("liveRoomDto").getAsJsonObject(), createlive.getId());
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_SellerLiveDetail_002() {
		Logger.start(true, "不输入liveid失败");
		try {
			sellerlivedetailCall.setData(sellerlivedetailBean);
			sellerlivedetailCall.addHeader("ymt-pars", "accesstoken=" + token);sellerlivedetailCall.callService();
			Logger.verifyEquals("400", sellerlivedetailCall.getString("code"), "验证Code");
			Logger.verifyIsContains("无效的直播编号", sellerlivedetailCall.getString("msg"), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SellerLiveDetail_003() {
		Logger.start(true, "直播状态2查询买手互动直播详情成功");
		try {
			LiveRoom createlive = LiveRoomShop2cnCallService.CreateSellerLive(LiveRoomShop2cnCallService.initCreatesellerliveBean(),sellerId);
			LiveRoomShop2cnCallService.enterGroup(createlive.getId(), 1);
			LiveRoomShop2cnCallService.getLikeCount(createlive.getId(), 1, 2);
			LiveRoomShop2cnCallService.SellerLiveOnline(createlive.getId(), createlive.getUserId());
			sellerlivedetailBean.setLiveId(createlive.getId());
			sellerlivedetailCall.setData(sellerlivedetailBean);
			sellerlivedetailCall.addHeader("ymt-pars", "accesstoken=" + token);sellerlivedetailCall.callService();
			verifyDB(sellerlivedetailCall.getJsonObject().get("liveRoomDto").getAsJsonObject(), createlive.getId());
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SellerLiveDetail_004() {
		Logger.start(true, "直播状态3查询买手互动直播详情成功");
		try {
			LiveRoom createlive = LiveRoomShop2cnCallService.CreateSellerLive(LiveRoomShop2cnCallService.initCreatesellerliveBean(),sellerId);
			LiveRoomShop2cnCallService.enterGroup(createlive.getId(), 1);
			LiveRoomShop2cnCallService.getLikeCount(createlive.getId(), 1, 2);
			LiveRoomShop2cnCallService.SellerLiveOnline(createlive.getId(), createlive.getUserId());
			liveRoomShop2nWapper.updateLiveRoomPushStatus(createlive.getId(), 3);
			sellerlivedetailBean.setLiveId(createlive.getId());
			sellerlivedetailCall.setData(sellerlivedetailBean);
			sellerlivedetailCall.addHeader("ymt-pars", "accesstoken=" + token);sellerlivedetailCall.callService();
			verifyDB(sellerlivedetailCall.getJsonObject().get("liveRoomDto").getAsJsonObject(), createlive.getId());
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SellerLiveDetail_005() {
		Logger.start(true, "直播状态7未推流查询买手互动直播详情成功");
		try {
			LiveRoom createlive = LiveRoomShop2cnCallService.CreateSellerLive(LiveRoomShop2cnCallService.initCreatesellerliveBean(),sellerId);
			LiveRoomShop2cnCallService.enterGroup(createlive.getId(), 1);
			LiveRoomShop2cnCallService.getLikeCount(createlive.getId(), 1, 2);
			//未推流
//			LiveRoomShop2cnCallService.SellerLiveOnline(createlive.getId(), createlive.getUserId());
			liveRoomShop2nWapper.updateLiveRoomPushStatus(createlive.getId(), 7);
			sellerlivedetailBean.setLiveId(createlive.getId());
			sellerlivedetailCall.setData(sellerlivedetailBean);
			sellerlivedetailCall.addHeader("ymt-pars", "accesstoken=" + token);sellerlivedetailCall.callService();
			
			verifyDB(sellerlivedetailCall.getJsonObject().get("liveRoomDto").getAsJsonObject(), createlive.getId());
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SellerLiveDetail_006() {
		Logger.start(true, "直播状态8查询买手互动直播详情成功");
		try {
			LiveRoom createlive = LiveRoomShop2cnCallService.CreateSellerLive(LiveRoomShop2cnCallService.initCreatesellerliveBean(),sellerId);
			LiveRoomShop2cnCallService.enterGroup(createlive.getId(), 1);
			LiveRoomShop2cnCallService.getLikeCount(createlive.getId(), 1, 2);
			//8是未推流的
//			LiveRoomShop2cnCallService.SellerLiveOnline(createlive.getId(), createlive.getUserId());
			liveRoomShop2nWapper.updateLiveRoomPushStatus(createlive.getId(), 8);
			sellerlivedetailBean.setLiveId(createlive.getId());
			sellerlivedetailCall.setData(sellerlivedetailBean);
			sellerlivedetailCall.addHeader("ymt-pars", "accesstoken=" + token);sellerlivedetailCall.callService();
			
			verifyDB(sellerlivedetailCall.getJsonObject().get("liveRoomDto").getAsJsonObject(), createlive.getId());
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SellerLiveDetail_007() {
		Logger.start(true, "直播状态9查询买手互动直播详情成功");
		try {
			LiveRoom createlive = LiveRoomShop2cnCallService.CreateSellerLive(LiveRoomShop2cnCallService.initCreatesellerliveBean(),sellerId);
			LiveRoomShop2cnCallService.enterGroup(createlive.getId(), 1);
			LiveRoomShop2cnCallService.getLikeCount(createlive.getId(), 1, 2);
			LiveRoomShop2cnCallService.SellerLiveOnline(createlive.getId(), createlive.getUserId());
			liveRoomShop2nWapper.updateLiveRoomPushStatus(createlive.getId(), 9);
			sellerlivedetailBean.setLiveId(createlive.getId());
			sellerlivedetailCall.setData(sellerlivedetailBean);
			sellerlivedetailCall.addHeader("ymt-pars", "accesstoken=" + token);sellerlivedetailCall.callService();
			
			verifyDB(sellerlivedetailCall.getJsonObject().get("liveRoomDto").getAsJsonObject(), createlive.getId());
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SellerLiveDetail_008() {
		Logger.start(true, "直播状态10查询买手互动直播详情成功");
		try {
			LiveRoom createlive = LiveRoomShop2cnCallService.CreateSellerLive(LiveRoomShop2cnCallService.initCreatesellerliveBean(),sellerId);
			LiveRoomShop2cnCallService.enterGroup(createlive.getId(), 1);
			LiveRoomShop2cnCallService.getLikeCount(createlive.getId(), 1, 2);
			LiveRoomShop2cnCallService.SellerLiveOnline(createlive.getId(), createlive.getUserId());
			liveRoomShop2nWapper.updateLiveRoomPushStatus(createlive.getId(), 10);
			sellerlivedetailBean.setLiveId(createlive.getId());
			sellerlivedetailCall.setData(sellerlivedetailBean);
			sellerlivedetailCall.addHeader("ymt-pars", "accesstoken=" + token);sellerlivedetailCall.callService();
			
			verifyDB(sellerlivedetailCall.getJsonObject().get("liveRoomDto").getAsJsonObject(), createlive.getId());
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
//
//	@Test
//	@Category({ P1.class })
//	@TestCase
//	public void Tc_SellerLiveDetail_009() {
//		Logger.start(true, "直播结束回播地址查询正确");
//		try {
//			LiveRoom createlive = LiveRoomShop2cnCallService.CreateSellerLive(LiveRoomShop2cnCallService.initCreatesellerliveBean(),sellerId);
//			LiveRoomShop2cnCallService.enterGroup(createlive.getId(), 1);
//			LiveRoomShop2cnCallService.getLikeCount(createlive.getId(), 1, 2);
//			RecLiveNotifyBean recivenotifyBean = LiveRoomShop2cnCallService.initRecLiveNotifyBean(createlive.getId(), 100);
//			LiveRoomShop2cnCallService.LiveNotify(recivenotifyBean);
//			sellerlivedetailBean.setLiveId(createlive.getId());
//			sellerlivedetailCall.setData(sellerlivedetailBean);
//			sellerlivedetailCall.addHeader("ymt-pars", "accesstoken=" + token);sellerlivedetailCall.callService();
//			
//			verifyDB(sellerlivedetailCall.getJsonObject().get("liveRoomDto").getAsJsonObject(), createlive.getId());
//		} catch (Exception e) {
//			Logger.fail(e);
//		}
//	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SellerLiveDetail_010() {
		Logger.start(true, "查询买手互动直播待开始");
		try {
			LiveRoom createlive = LiveRoomShop2cnCallService.CreateSellerLive(LiveRoomShop2cnCallService.initCreatesellerliveBean(),sellerId);
			LiveRoomShop2cnCallService.enterGroup(createlive.getId(), 1);
			LiveRoomShop2cnCallService.getLikeCount(createlive.getId(), 1, 2);
			LiveRoomShop2cnCallService.UpdateLiveTimeToStart(createlive.getId());
			sellerlivedetailBean.setLiveId(createlive.getId());
			sellerlivedetailCall.setData(sellerlivedetailBean);
			sellerlivedetailCall.addHeader("ymt-pars", "accesstoken=" + token);sellerlivedetailCall.callService();
			
			verifyDB(sellerlivedetailCall.getJsonObject().get("liveRoomDto").getAsJsonObject(), createlive.getId());
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SellerLiveDetail_011() {
		Logger.start(true, "直播状态7已推流查询买手互动直播详情成功");
		try {
			LiveRoom createlive = LiveRoomShop2cnCallService.CreateSellerLive(LiveRoomShop2cnCallService.initCreatesellerliveBean(),sellerId);
			LiveRoomShop2cnCallService.enterGroup(createlive.getId(), 1);
			LiveRoomShop2cnCallService.getLikeCount(createlive.getId(), 1, 2);
			LiveRoomShop2cnCallService.SellerLiveOnline(createlive.getId(), createlive.getUserId());
			liveRoomShop2nWapper.updateLiveRoomPushStatus(createlive.getId(), 7);
			sellerlivedetailBean.setLiveId(createlive.getId());
			sellerlivedetailCall.setData(sellerlivedetailBean);
			sellerlivedetailCall.addHeader("ymt-pars", "accesstoken=" + token);sellerlivedetailCall.callService();
			
			verifyDB(sellerlivedetailCall.getJsonObject().get("liveRoomDto").getAsJsonObject(), createlive.getId());
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SellerLiveDetail_012() {
		Logger.start(true, "查询买手互动直播详情成功,查看公告");
		try {
			LiveRoom createlive = LiveRoomShop2cnCallService.CreateSellerLive(LiveRoomShop2cnCallService.initCreatesellerliveBean(),sellerId);
			String content="content";
			LiveRoomShop2cnCallService.SaveLiveNotice(createlive.getId(), "content");
			LiveRoomShop2cnCallService.enterGroup(createlive.getId(), 1);
			LiveRoomShop2cnCallService.getLikeCount(createlive.getId(), 1, 2);
			sellerlivedetailBean.setLiveId(createlive.getId());
			sellerlivedetailCall.setData(sellerlivedetailBean);
			sellerlivedetailCall.addHeader("ymt-pars", "accesstoken=" + token);sellerlivedetailCall.callService();
			
			verifyDB(sellerlivedetailCall.getJsonObject().get("liveRoomDto").getAsJsonObject(), createlive.getId());
//			Logger.verifyEquals(content, sellerlivedetailCall.getJsonObject().get("liveRoomDto").getAsJsonObject().get("liveNoticeContent").getAsString(),"验证liveNoticeContent");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P1.class })
	@TestCase
	@Ignore
	public void Tc_SellerLiveDetail_013() {
		Logger.start(true, "查询买手互动直播详情成功-直播排位赛");
		try {
			LiveRoom createlive = LiveRoomShop2cnCallService.CreateSellerLive(LiveRoomShop2cnCallService.initCreatesellerliveBean(),sellerId);
			int tabid=10;
			LiveRoomShop2cnCallService.SyncLivesellerTop(createlive.getUserId(), createlive.getId(), 1, tabid);
			sellerlivedetailBean.setLiveId(createlive.getId());
			sellerlivedetailCall.setData(sellerlivedetailBean);
			sellerlivedetailCall.addHeader("ymt-pars", "accesstoken=" + token);sellerlivedetailCall.callService();
			
			verifyDB(sellerlivedetailCall.getJsonObject().get("liveRoomDto").getAsJsonObject(), createlive.getId());
			JsonObject TopInfoDto = sellerlivedetailCall.getJsonObject().get("liveRoomDto").getAsJsonObject().get("topInfo").getAsJsonObject();
			Logger.verifyEquals(1, TopInfoDto.get("topNum").getAsInt(), "topNum");
			Logger.verifyEquals("美容家居榜", TopInfoDto.get("topName").getAsString(), "topName");
			Logger.verifyEquals("https://m.ymatou.com/evt2/n756?winType=16&tabid="+tabid, TopInfoDto.get("topLink").getAsString(), "topLink");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SellerLiveDetail_014() {
		Logger.start(true, "客服查询买手互动直播详情成功");
		try {
			LiveRoom createlive = LiveRoomShop2cnCallService.CreateSellerLive(LiveRoomShop2cnCallService.initCreatesellerliveBean(),sellerId);
			LiveRoomShop2cnCallService.enterGroup(createlive.getId(), 1);
			LiveRoomShop2cnCallService.getLikeCount(createlive.getId(), 1, 2);
			sellerlivedetailBean.setLiveId(createlive.getId());
			sellerlivedetailCall.setData(sellerlivedetailBean);
			sellerlivedetailCall.addHeader("ymt-pars", "accesstoken=" + cstoken);
			sellerlivedetailCall.callService();
//			
			System.out.println(sellerlivedetailCall.getJsonObject().get("liveRoomDto").getAsJsonObject());
			verifyDB(sellerlivedetailCall.getJsonObject().get("liveRoomDto").getAsJsonObject(), createlive.getId());
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SellerLiveDetail_015() {
		Logger.start(true, "查询买手互动直播详情成功-查自己-代理直播");
		try {
			LiveRoom createlive = LiveRoomShop2cnCallService.CreateSellerLive(LiveRoomShop2cnCallService.initCreatesellerliveBean(),sellerId);
			LiveRoomShop2cnCallService.SetisLiveinherit(sellerId, createlive.getId(), 1);
			LiveRoomShop2cnCallService.enterGroup(createlive.getId(), 1);
			LiveRoomShop2cnCallService.getLikeCount(createlive.getId(), 1, 2);
			sellerlivedetailBean.setLiveId(createlive.getId());
			sellerlivedetailCall.setData(sellerlivedetailBean);
			sellerlivedetailCall.addHeader("ymt-pars", "accesstoken=" + token);sellerlivedetailCall.addHeader("ymt-pars", "accesstoken=" + token);sellerlivedetailCall.callService();
//			
			System.out.println(sellerlivedetailCall.getJsonObject().get("liveRoomDto").getAsJsonObject());
			Logger.verifyEquals(true, sellerlivedetailCall.getJsonObject().get("liveRoomDto").getAsJsonObject().get("liveInherit").getAsBoolean(), "liveInherit");
			Logger.verifyEquals(false, sellerlivedetailCall.getJsonObject().get("liveRoomDto").getAsJsonObject().get("inherited").getAsBoolean(), "inherited");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SellerLiveDetail_016() {
		Logger.start(true, "查询买手互动直播详情成功-下级-代理直播");
		try {
			LiveRoom createlive = LiveRoomShop2cnCallService.CreateSellerLive(LiveRoomShop2cnCallService.initCreatesellerliveBean(),sellerId);
			LiveRoomShop2cnCallService.SetisLiveinherit(sellerId, createlive.getId(), 1);
			Integer InheritUserId=GodmchManageCallService.createAgent(sellerId);;
			LiveRoomShop2cnCallService.AddLiveToShop(createlive.getId(), InheritUserId, sellerId);
			LiveRoomShop2cnCallService.enterGroup(createlive.getId(), 1);
			LiveRoomShop2cnCallService.getLikeCount(createlive.getId(), 1, 2);
			sellerlivedetailBean.setLiveId(createlive.getId());
			sellerlivedetailCall.setData(sellerlivedetailBean);
			String token2 = AuthCallServiceV2.createToken(InheritUserId, "app");
			sellerlivedetailCall.addHeader("ymt-pars", "accesstoken=" + token2);
			sellerlivedetailCall.callService();
//			
			System.out.println(sellerlivedetailCall.getJsonObject().get("liveRoomDto").getAsJsonObject());
			Logger.verifyEquals(true, sellerlivedetailCall.getJsonObject().get("liveRoomDto").getAsJsonObject().get("liveInherit").getAsBoolean(), "liveInherit");
			Logger.verifyEquals(true, sellerlivedetailCall.getJsonObject().get("liveRoomDto").getAsJsonObject().get("inherited").getAsBoolean(), "inherited");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}

